<template>
	<view>
		<view>
			<u--form labelAlign="left">
				<view class="informationCss">
					<u-form-item label="企业名称: " labelWidth="100%" />
					<u-form-item :label="lablesList.name" labelWidth="100%" />
				</view>
				<view class="informationCss">
					<u-form-item label="联系人: " labelWidth="100%" />
					<u-form-item :label="lablesList.contact" labelWidth="100%" />
				</view>

				<view class="informationCss">
					<u-form-item label="联系电话: " labelWidth="100%" />
					<u-form-item :label="lablesList.phone" labelWidth="100%" />
				</view>
				<view class="informationCss">
					<u-form-item label="地址: " labelWidth="100%" />
					<u-form-item :label="lablesList.address" labelWidth="100%" />
				</view>
				<view class="informationCss">
					<u-form-item label="成立时间: " labelWidth="100%" />
					<u-form-item labelWidth="100%">
						<uni-dateformat :date="lablesList.dateOfEstablishment "
							:format="'yyyy'+'年'+'MM'+'月'+'dd'+'日'" />
					</u-form-item>
				</view>
				<view class="informationCss">
					<u-form-item label="营业执照: " labelWidth="100%" />
					<image :src="lablesList.businessLicenseUrl" class="imgUrl" mode="heightFix"></image>
				</view>
				<view class="informationCss">
					<u-form-item label="企业简介: " labelWidth="100%" />
					<u-parse :content="lablesList.introduction" disabled="true" class="uparseCss"/>
				</view>
				<view class="infoButton">
					<u-button type="error" text="解除绑定" @click="unbindClick"></u-button>
				</view>
			</u--form>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		data() {
			return {
				show: false,
				mode: 'single',
				infoStatus: 1,
				lablesList: {}
			}
		},
		onLoad() {
			this.getList()
		},
		methods: {
			unbindClick() {
				const that = this
				uni.showModal({
					title: '解除绑定？',
					content: '您确定要解除绑定企业认证吗？',
					success: (e) => {
						if (e.confirm) {
							that.$api.request('enterprise', 'unbind').then(res => {
								uni.showToast({
									title: '解除成功',
									duration: 1000,
								});
								setTimeout(()=>{
									uni.navigateBack()
								},800)
							})  
						}
					}
				}) 
			},
			getList() {
				const that = this
				uni.showLoading({
					title: "正在加载",
				});
				that.$api.request('enterprise', 'detail', {}).then(res => {
					uni.hideLoading();
					that.lablesList = res.data
					console.log(res.data, 999);
				})
			}
		}
	}
</script>

<style lang="scss">
	uni-view.u-popup {
		flex: none;
	}

	uni-view.u-textarea.u-border.u-textarea--radius {
		margin: 0 20rpx 0 0;
	}

	.informationCss {
		display: flex;
		justify-content: space-between;
		padding: 10rpx 30rpx;
		border-bottom: 1px solid #eee;

	.uparseCss{
		line-height: 1.7;
		width: 100%;
		background-color: #f5f7fa;
		padding: 20rpx;
		margin: 20rpx 6rpx 20rpx 16rpx;
		border-radius: 4px;
		border: 0.5px solid #dadbde !important;
	}
		.imgUrl {
			height: 250rpx;
			margin-top: 20rpx;
			margin-left: 20rpx;
		}
	}

	.infoTextarea {
		display: flex;
		padding: 30rpx 0 30rpx 30rpx;
		margin-right: 20rpx;
	}

	.infoButton {
		display: flex;
		margin: 0 auto;
		padding: 30rpx;
	}
</style>
